using System;
using System.Collections.Generic;
using System.Text;

namespace Web.Core.Objects
{
    public class Member
    {
        int _id;
        string _password, _firstName, _lastName, _dateOfBirth, _address, _email, _phone, _dateAdded, _sQuestion, _sAnswer, _lastLogin;
        Role _role;
        GlobalStorage.Sex _sex;

        #region Public Data
        public int ID
        {
            get { return _id; }
            set { _id = value; }
        }

        public string Password
        {
            get { return _password; }
            set { _password = value; }
        }

        public GlobalStorage.Sex Sex
        {
            get { return _sex; }
            set { _sex = value; }
        }

        public string FirstName
        {
            get { return _firstName; }
            set { _firstName = value; }
        }

        public string LastName
        {
            get { return _lastName; }
            set { _lastName = value; }
        }

        public string LastLogin
        {
            get { return _lastLogin; }
            set { _lastLogin = value; }
        }

        public string DateOfBirth
        {
            get { return _dateOfBirth; }
            set { _dateOfBirth = value; }
        }

        public string Address
        {
            get { return _address; }
            set { _address = value; }
        }

        public string Email
        {
            get { return _email; }
            set { _email = value; }
        }

        public string Phone
        {
            get { return _phone; }
            set { _phone = value; }
        }

        public string DateAdded
        {
            get { return _dateAdded; }
            set { _dateAdded = value; }
        }

        public string SQuestion
        {
            get { return _sQuestion; }
            set { _sQuestion = value; }
        }

        public string SAnswer
        {
            get { return _sAnswer; }
            set { _sAnswer = value; }
        }

        public Role Role
        {
            get { return _role; }
            set { _role = value; }
        }
        #endregion

        public Member() { }

        public Member(int id, string email, string password, GlobalStorage.Sex sex, string fName, string lName, string dateOfBirth, string address, string phone, string dateadded, string squestion, string sanswer, Role role, string lastLogin)
        {
            ID = id;            
            Password = password;
            Sex = sex;
            FirstName = fName;
            LastName = lName;
            DateOfBirth = dateOfBirth;
            Address = address;
            Email = email;
            Phone = phone;
            DateAdded = dateadded;
            SQuestion = squestion;
            SAnswer = sanswer;
            Role = role;
            LastLogin = lastLogin;
        }

        public bool IsAdministrator()
        {
            if (Role.ID == GlobalStorage.WebRoles.Administrators.ID)
                return true;
            else
                return false;
        }

        public bool IsEditor()
        {
            if (Role.ID == GlobalStorage.WebRoles.Editors.ID)
                return true;
            else
                return false;
        }

        public bool IsCustomer()
        {
            if (Role.ID == GlobalStorage.WebRoles.Customers.ID)
                return true;
            else
                return false;
        }
    }
}
